package com.gec.dao;

import java.sql.SQLException;
import java.util.List;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;

import com.gec.entity.Category;
import com.gec.utils.C3P0Utils;

public class CategoryDao {
    
    private QueryRunner qr = new QueryRunner(C3P0Utils.getDataSource());

    /**
     * 查询商品分类
     * 
     * @return
     */
    public List<Category> getCategoryList() {
	String sql = "select *  from category";
	List<Category> list = null;
	try {
	    list = qr.query(sql, new BeanListHandler<>(Category.class));
	} catch (SQLException e) {
	    e.printStackTrace();
	}
	return list;
    }

}
